package com.restaurant.application.exchangegoods.support;

import com.google.common.collect.Lists;
import com.nebutown.generation.Convert;
import com.nebutown.generation.PickableBean;
import com.nebutown.generation.basictype.UID;
import java.lang.Long;
import java.util.List;

public class ExchangeDetailData implements PickableBean {
    
    public static final String FN_GOODSUID = "goodsUID";
    public static final String FN_GOODSNAME = "goodsName";
    public static final String FN_CUSTOMERUID = "customerUID";
    public static final String FN_CUSTOMERNAME = "customerName";
    public static final String FN_EXCHANGETIME = "exchangeTime";
    
    public static final List<String> FIELD_NAMES = Lists.newArrayList(
             FN_GOODSUID,
             FN_GOODSNAME,
             FN_CUSTOMERUID,
             FN_CUSTOMERNAME,
             FN_EXCHANGETIME);
    
    private UID goodsUID;
    private UID goodsName;
    private UID customerUID;
    private UID customerName;
    private Long exchangeTime;
    
    public ExchangeDetailData(UID goodsUID, UID goodsName, UID customerUID, UID customerName, Long exchangeTime) {
        setGoodsUID(goodsUID);
        setGoodsName(goodsName);
        setCustomerUID(customerUID);
        setCustomerName(customerName);
        setExchangeTime(exchangeTime);
    }
    
    public ExchangeDetailData() {
    }
    
    public ExchangeDetailData duplicate() {
        ExchangeDetailData result = new ExchangeDetailData();
        result.goodsUID = this.goodsUID;
        result.goodsName = this.goodsName;
        result.customerUID = this.customerUID;
        result.customerName = this.customerName;
        result.exchangeTime = this.exchangeTime;
        return result;
    }
    
    @Override
    public String toString() {
        return Convert.toJson(this);
    }
    
    public UID getGoodsUID() {
        return goodsUID;
    }
    
    public void  setGoodsUID(UID value) {
        this.goodsUID = value;
    }
    
    public ExchangeDetailData withGoodsUID(UID value) {
        setGoodsUID(value);
        return this;
    }
    
    public ExchangeDetailData withGoodsUID(UID value, UID defaultValue) {
        setGoodsUID(value == null ? defaultValue : value);
        return this;
    }
    
    public UID getGoodsName() {
        return goodsName;
    }
    
    public void  setGoodsName(UID value) {
        this.goodsName = value;
    }
    
    public ExchangeDetailData withGoodsName(UID value) {
        setGoodsName(value);
        return this;
    }
    
    public ExchangeDetailData withGoodsName(UID value, UID defaultValue) {
        setGoodsName(value == null ? defaultValue : value);
        return this;
    }
    
    public UID getCustomerUID() {
        return customerUID;
    }
    
    public void  setCustomerUID(UID value) {
        this.customerUID = value;
    }
    
    public ExchangeDetailData withCustomerUID(UID value) {
        setCustomerUID(value);
        return this;
    }
    
    public ExchangeDetailData withCustomerUID(UID value, UID defaultValue) {
        setCustomerUID(value == null ? defaultValue : value);
        return this;
    }
    
    public UID getCustomerName() {
        return customerName;
    }
    
    public void  setCustomerName(UID value) {
        this.customerName = value;
    }
    
    public ExchangeDetailData withCustomerName(UID value) {
        setCustomerName(value);
        return this;
    }
    
    public ExchangeDetailData withCustomerName(UID value, UID defaultValue) {
        setCustomerName(value == null ? defaultValue : value);
        return this;
    }
    
    public Long getExchangeTime() {
        return exchangeTime;
    }
    
    public void  setExchangeTime(Long value) {
        this.exchangeTime = value;
    }
    
    public ExchangeDetailData withExchangeTime(Long value) {
        setExchangeTime(value);
        return this;
    }
    
    public ExchangeDetailData withExchangeTime(Long value, Long defaultValue) {
        setExchangeTime(value == null ? defaultValue : value);
        return this;
    }
    
    public Object getValueOf(String name) {
        switch(name) {
        case "goodsUID": return getGoodsUID();
        case "goodsName": return getGoodsName();
        case "customerUID": return getCustomerUID();
        case "customerName": return getCustomerName();
        case "exchangeTime": return getExchangeTime();
        }
        return null;
    }
    
    public boolean hasField(String name) {
        return FIELD_NAMES.contains(name);
    }
    
    @Override
    public int hashCode() {
        return signature().hashCode();
    }
    
    @Override
    public boolean equals(Object o) {
        if(!(o instanceof ExchangeDetailData)) return false;
        return signature().equals(((ExchangeDetailData)o).signature());
    }
    
    public String signature() {
        throw new RuntimeException("Bean ExchangeDetailData has no signature defined, no hash code or equals possible.");
    }
}
